/*
 * @Author: zc
 * @Date: 2019-11-26 14:52:04
 * @LastEditors: zc
 * @LastEditTime: 2020-05-13 15:04:01
 */

import * as React from 'react';
import { Route } from 'react-router-dom';

export function RouteWithSubRoutes(route: any) {
  return (
    <Route
      strict
      path={route.path}
      exact={route.exact}
      render={props => {
        document.title = route.title || '';
        return (
          // pass the sub-routes down to keep nesting
          <route.component {...props} routes={route.routes} />
        );
      }}
    />
  );
}
